import React, { Component } from 'react';
import {
	StyleSheet, View
} from "react-native";
import { GLOBAL } from '../../../../config/global';
import { style } from '../../../../theme/style';
import { BaseItem } from './BaseItem';

const scale = GLOBAL.SCALE;
export class CommonChangeInfo extends Component {
	constructor(props) {
		super(props);
	}

	render() {
		const { data, changeType, beforeValueOnPress, afterValueOnPress, currencyName } = this.props;
		console.log("data", data)
		return (
			<View>
				{
					data && data.length ? data.map((item, index) => {
						const { changeLineTypeName, beforeValueDesc, afterValueDesc, afterValue, beforeValue, rfuValue1, rfuValue2, rfuValue3 } = item || {};
						let title = changeLineTypeName;
						if (rfuValue1 || rfuValue3) {
							title += `(${rfuValue1})`;
						}
						return (
							<BaseItem key={index}
								//smallTitle={rfuValue2 || null} // 区分不同的物料
								currencyName={currencyName}
								label={title}
								beforeValueDesc={beforeValueDesc}
								afterValueDesc={afterValueDesc}
								beforeValue={beforeValue}
								afterValue={afterValue}
								valueStyle={changeType == 'CONTRACT_INFO' ? { color: style.color.themeColor } : {}}
								beforeValueOnPress={() => changeType == 'CONTRACT_INFO' ? beforeValueOnPress(beforeValue) : null}
								afterValueOnPress={() => changeType == 'CONTRACT_INFO' ? afterValueOnPress(afterValue) : null}
							/>
						)
					})
						: null
				}
			</View>

		)
	}
}

const styles = StyleSheet.create({


})